package com.example.api.entity;

import com.example.api.common.validation.ValidationGroups;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private Long id;
    
    @NotBlank(message = "用户名不能为空", groups = {ValidationGroups.Create.class})
    @Size(min = 4, max = 20, message = "用户名长度必须在4-20个字符之间", groups = {ValidationGroups.Create.class})
    private String username;
    
    @NotBlank(message = "密码不能为空", groups = {ValidationGroups.Create.class})
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间", groups = {ValidationGroups.Create.class})
    private String password;
    
    @Email(message = "邮箱格式不正确", groups = {ValidationGroups.Create.class, ValidationGroups.Update.class})
    private String email;
    
    private LocalDateTime createTime;
    private LocalDateTime updateTime;
} 